<?php
        class home extends model {
           
           function view(){ 
           
          $arraynewdata= $this->getdefault();

          if(is_file(templatepath.'/index.php')&&$_SERVER['REQUEST_URI']!="/home")
          {
          $arraynewdata['province']=$this->getprovince();
          $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/hometoc.css';
         
           if(TitleDmconnex=='s i m p l e   m e a l 3 3'||TitleDmconnex=='Women 24')
          {
          
          $arraynewdata['feature']=$this->info['configall']['feature'];
          if(count($arraynewdata['feature']))
          {
          $k=0;
          foreach($arraynewdata['feature'] as $valuefeature)
          {
          $arraynewdata['product'][$k]['tag']=$this->gettagbyfid($valuefeature['fid'],1,1);
          
          $groupby='';
          $innerjoin='';
          
          if(count($arraynewdata['product'][$k]['tag']))
          {
          $groupby=' group by tb_product.productid';
          $innerjoin=' INNER JOIN tb_relate_tag ON tb_relate_tag.productid = tb_product.productid ';
          
          $tagid=$arraynewdata['product'][$k]['tag'][0]['tagid'];
          $where=' where tb_product.fid='.$valuefeature['fid'].' and tb_relate_tag.tagid='.$tagid.' and tb_product.delete=0 and tb_product.status=1';;
          }else
          {
          $where=' where ((tb_product.fid='.$valuefeature['fid'].' and tb_product.delete=0 and tb_product.status=1)  or (tb_product.productid IN (select productid from tb_product_point where fid='.$valuefeature['fid'].') ) ) ';
          
          }
          
          $limit=' limit 0,9';
          $orderby=1;
          $arraynewdata['product'][$k]['data']=$this->getproductbycondition($where,$limit,$orderb,$innerjoin,$groupby,'',1);
          
          $arraynewdata['product'][$k]['name']=$valuefeature['name'];
          $arraynewdata['product'][$k]['link']=$valuefeature['link'];
          $arraynewdata['product'][$k]['fid']=$valuefeature['fid'];
          
          $k++;

          }
               
          }
          
          
          }
          
          
          $this->loaddata('index',$arraynewdata);  
          }else
          {
          if(NameDmconnex=="Canonlife")
          {
          
          
          
          list($urinow,$urinow2)=explode("?",$_SERVER['REQUEST_URI']);
         $arrayuri=explode("/",$urinow);
         

         
         if($arrayuri['1']=="home")
         {
         $arraynewdata['featurename']='The-Idol';
          $arraynewdata['fid']=13;
         
         }else
         {
         
         
//         echo "<pre>";
//         print_r($this->info['configall']['feature'][0]['fid']);
//         echo "</pre>;";
//         exit;
         
         if($this->info['configall']['feature'][0]['fid'])
         {
         
         $arraynewdata['featurename']=$this->info['configall']['feature'][0]['name'];
         $arraynewdata['fid']=$this->info['configall']['feature'][0]['fid'];
         
         
         }         
         
         }
          
          
      //    exit;
          }
          else if(NameDmconnex=="ADS 2Bsimple")
          {
          
          //$arraynewdata['featurename']='The-Idol';
          //$arraynewdata['fid']=13;
          
          }
          else if(NameDmconnex=="9ENTERTAIN"||NameDmconnex=="Issue24")
          {
          
            list($urinow,$urinow2)=explode("?",$_SERVER['REQUEST_URI']);
         $arrayuri=explode("/",$urinow);
         

         
         if($arrayuri['1']=="home")
         {
         $arraynewdata['featurename']='newsfeed';
          $arraynewdata['fid']=1;
         
         }else
         {
         
         
//         echo "<pre>";
//         print_r($this->info['configall']['feature'][0]['fid']);
//         echo "</pre>;";
//         exit;
         
         if($this->info['configall']['feature'][0]['fid'])
         {
         
         $arraynewdata['featurename']=$this->info['configall']['feature'][0]['name'];
         $arraynewdata['fid']=$this->info['configall']['feature'][0]['fid'];
         
         
         }         
         
         }
          
          
          
          
          }
          $page=1;
          if($_GET['page'])
          {
          $page=$_GET['page'];

          }
          
          
          $arraynewdata['sitemap']=$this->getproductbyconditionshort($page,0,0);
          
          

          

          $this->loadtemplate('submain',$arraynewdata);  
          
          }
          
           }
        
        
        }
?>
